//
//  WmcHomeVM+Business.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/5/12.
//

import Foundation

extension WmcHomeVM {
    // MARK: - 业务方法

    /// 加载业务总线
    func loadBusinessBus() {
        yupao_integral()
    }

    // MARK: 鱼泡网送积分业务

    /// 鱼泡网送积分业务
    func yupao_integral() {
        // 判断要开启哪些活动，向外部询问是否需要请求接口
        let activity = YPWmcManager.shared.delegate.activityDelegate?.openActivityType(.current)
        guard activity?.contains(.yp_giveIntegral) == true else { return }
        // 包含送积分活动
        WmcIntegralBusinessAPI.integralQualification(activity: YPWmcManager.ActivityType.yp_giveIntegral.info.activityValue)
            .subscribe(onNext: { [weak self] model in
                guard let weakSelf = self else { return }
                weakSelf.business_integralRelay.accept(model)
            }).disposed(by: rx.disposeBag)
    }
}
